import {request} from "../../request";

export function getRecipientsbackById(id){
    return request({
        url:`/lswms/recipientsback/${id}`,
        method:'get'
    })
}


export function getRecipientsbackPage(data){
    return request({
        url:'/lswms/recipientsback/page',
        method:'put',
        data:data
    })
}

export function putRecipientsback(data){
    return request({
        url:'/lswms/recipientsback',
        method:'put',
        data:data
    })
}
export function postRecipientsback(data){
    return request({
        url:'/lswms/recipientsback',
        method:'post',
        data:data
    })
}

export function deleteRecipientsback(data){
    return request({
        url:`/lswms/recipientsback`,
        method:'delete',
        data:data
    })
}
export function exportRecipientsback(data){
    return request({
        url:`/lswms/recipientsback/export`,
        method:'get',
        data:data,
        responseType:'blob'
    })
}
//导出
export function exportHandle1(url,data){
    request({
        url: url,
        method: 'get',
        params: data,
        responseType: 'blob'
    }).then((res) => {
        let fileName = 'SamplePointsDetail.xls' //excel文件名称
        let blob = new Blob([res.data], {
            type: 'application/x-xls'
        }) //word文档为msword,pdf文档为pdf，excel文档为x-xls
        if (window.navigator.msSaveOrOpenBlob) {
            navigator.msSaveBlob(blob, fileName);
        } else {
            var link = document.createElement('a');
            link.href = window.URL.createObjectURL(blob);
            link.download = fileName;
            link.click();
            window.URL.revokeObjectURL(link.href);
        }

    })

}